package com.li.tree;

public class BinaryTreeDemo {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        HeroNode root = new HeroNode(1, "宋江");
        HeroNode node2 = new HeroNode(2, "吴用");
        HeroNode node3 = new HeroNode(3, "卢俊义");
        HeroNode node4 = new HeroNode(4, "林冲");
        HeroNode node5 = new HeroNode(5, "关胜");
        root.setLeft(node2);
        root.setRight(node3);
        node3.setRight(node4);
        node3.setLeft(node5);
        /*System.out.println("前序遍历");
        binaryTree.setRoot(root);
        binaryTree.preOrder();
        System.out.println("后序遍历");
        binaryTree.postOrder();
        System.out.println("中序遍历");
        binaryTree.infixOrder();
        System.out.println("前序");
        HeroNode res = binaryTree.preOrderSearch(5);
        if (res!=null){
            System.out.printf("找到了，no=%d,name=%s",res.getNo(),res.getName());
        }else {
            System.out.println("没有找到");
        }*/
        System.out.println("前序遍历");
        binaryTree.setRoot(root);
        binaryTree.preOrder();
        System.out.println("删除后");
        binaryTree.delNode(5);
        binaryTree.preOrder();


    }
}
